package com.fa4j.system.settings.controller;

import com.fa4j.system.settings.DictClient;
import com.fa4j.system.settings.convert.DictConverter;
import com.fa4j.system.settings.dto.SystemDictBatchSaveRequest;
import com.fa4j.system.settings.model.DictBatchSaveCmd;
import com.fa4j.system.settings.service.DictService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/system/settings/dict")
@RequiredArgsConstructor
public class DictResource implements DictClient {

    private final DictService dictService;
    private final DictConverter dictConverter;

    @Override
    public void batchSave(SystemDictBatchSaveRequest request) {
        DictBatchSaveCmd cmd = dictConverter.toBatchCmd(request);
        dictService.batchSave(cmd);
    }
}
